home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
util
/
pack
/
brlecomp.lha
/
BRLECompressor.TXT
< prev
next >
Wrap
Text File
|
1992-10-24
|
9KB
|
239 lines
-----------------------------------------------------------------------------
B.R.L.E IMAGE COMPRESSOR V1 - (C) 1999 NAVEED KHUGIANI / ALGOTECH SOFTWARE
-----------------------------------------------------------------------------
DISCLAIMER
A Short but effective disclaimer...
No responsibility will be taken for any damage to anything due to use of
this program. Use at your own risk.
INTRODUCTION
Digitized imagery takes up a lot of diskspace. A few dozen images of this
type can use megabytes of diskspace. To save diskspace there is the option
of using JPEG compression. This will indeed make the image a lot smaller
but the quality of the image will be worse than the original and JPEG
compression/decompression takes up lots of processor time.
Ideally the image should be compressed without any loss in quality and be
compressed and decompressed very quickly when needed.
WHAT DOES THIS PROGRAM DO ?
This program compresses a 320x256 greyscale chunky format image to around
a quarter of its original size very quickly. This compressed file
can be stored away and viewed using this utility or optionally decompressed
and saved in one of 3 file formats.
A typical greyscale image which would normally take up 81920 bytes (80k) can
be compressed to 22k in just 2 seconds on a standard 68000 processor.
The size of the compressed file is better than the majority of other
compression programs which would take up to 300 times longer and still give
a larger file size.
SYSTEM REQUIREMENTS
This utility will run on any Amiga system and any kickstart version. The
program can use up to 256k of ram when decompressing. but this should be no
problem even for 512k Amiga systems.
PROGRAM SYNTAX
To compress data
BRLECompressor -c <sourcefile> <destfile>
-c : Using this parameter tells the utility to compress the data
<sourcefile> is the image file. It must be a 320x256 chunky image which is
81920 bytes in size.
<destfile> is the name of the compressed data to create
To decompress data
BRLECompressor -d <sourcefile> <destfile> <saveformat>
-d : Using this parameter tells the utility to decompress the data
<sourcefile> is the name of the compressed image.
<destfile> is the name of the decompressed file to create.
<saveformat> can be any one of the following :
-S1 : Amiga RAW PLANAR (40960 bytes)
-S2 : CHUNKY 320x256 (81920 bytes)
-S3 : IFF ILBM (uncompressed)
To view the compressed image.
BRLECompressor -v <sourcefile>
-v : Using this parameter tells the utility to view the compressed image.
<sourcefile> is the name of the compressed image.
Currently the program can only compress greyscale (16 colour) 320x256
images. The file size has to be exactly 81920 bytes (320x256 bytes)
Utilities such as GFXMaster and PicCon can load images and save them in this
format. It is important to ensure that the image is in 16 shade greyscale
with a linear palette (starting from black and gradually increasing to
white)
EXAMPLES
Included in this archive is a raw CHUNKY 320x256 file called 'emmaspc.raw'.
To compress this file and to call the compressed file 'testfile' type in
something like this:
BRLECompressor -c emmaspc.raw testfile
After a few seconds the file will be compressed.
To view this compressed image file:
BRLECompressor -v testfile
The image will be displayed after decompression.
It is also possible to decompress the compressed file to one of three
different formats. To decompress the file to an IFF ILBM and to call the
ILBM file 'test.iff' :
BRLECompressor -d testfile test.iff -s3
This will decompress the compressed file and save it as an ILBM file called
'test.iff'
WHAT THIS UTILITY CAN BE USED FOR
* Fast archived image storage. Images can be compressed fast and stored
away taking up a very small size. Can be viewed and decompressed back to
the original form whenever needed at a very high speed.
* Disk slideshows. Around 40 images (Yes 40!) can be stored on 1 disk and
this program can be used to decompress and view them at very high speed.
TECHNICAL
The compressor uses a bit based run length encoder which takes up 1 bit for
every repeating byte in the image data sequence. This gives excellent
compression for most types of complex digitized images. but can give very
poor compression ratio's if the compression is applied to data which
features lots of empty gaps in the image.
A typical run length encoder would be able to store hundreds of repeating
bytes along with a marker in just 2 or 3 bytes.
Using the method in this program, a constantly repeating section of data
which is the same for 1000 pixels would take up 1000 bits (over 100 bytes)
This is why it is important to ensure that the image is full screen and
consists of lots of digitized data.
This Image compression algorithm performs better than most compressors
because it works directly on chunky images and is specifically suited for
complex greyscale digipics. However it seems that powerful LZ based
routines (LZX & Crunchmania) can give better compression if compressing the
original chunky data. A few reasons why the BRLECompressor can be ideal for
compressing images and viewing them later.
Example:
A straightforward way to compress images to give good compression and easy
viewing would be to compress an IFF ILBM file using a program such as
crunchmania. Once a selection of files are compressed. A patch such as
'RTDD' can be run and most picture viewers will automatically decompress the
file after loading.
However the compression will normally be poorer as the compressor has worked
directly on the IFF ILBM file.
Compression can be better (better than the BRLECompressor) if the IFF ILBM
was converted to CHUNKY and then compressed but is there a viewer which can
load chunky images directly?? No! So this method cannot be used.
As the BRLECompressor decompresses to chunky and converts to planar (to
display the image) very fast. This seems to be the ideal solution.
Good compression ratio and very fast speed.
The whole point in this utility is to provide superfast speed in compression
and decompression while still giving a better compression ratio than most
compressors.
QUESTIONS AND ANSWERS
Q: Why does decompression of a file take longer than compression when
viewing a compressed file or saving in ILBM or RAW Planar
A: The reasone why compression is so fast is because the program loads a
chunky image directly without conversion and compresses the data.
On the other hand. When decompressing a file, the file in most cases has
to be converted after decompression to PLANAR format. This is why the
decompressor can take longer. The actual decompressor is just as fast as
the compressor.
Q: When viewing a compressed file using this utility, the picture appears
scrambled.
A: In most cases this is because the order of the palette data in a
greyscale image was different when originally compressing the chunky
data.
The original image which is to be converted to CHUNKY format and
compressed using this utility has to have a dark-light linear greyscale
palette which starts from black and gradually goes to white.
It is also important to ensure that the image has no more than 16 shades.
COMPRESSION GAINS
Most compressors use LZ based compression which works very well for
compressing chunky images. The disadvantage is that compression is slow and
that the image has to be translated back to PLANAR in order to be displayed.
As stated earlier on, a straightforward way would be to compress the IFF
Image directly. As an example a 16 shade digipic called 'emmaspc.raw'
consisting of complex digitized data would be compressed to 32764 bytes when
using run length encoding (as used in IFF ILBM files) This file can be
reduced to around 25683 bytes when using LZH Crunchmania Data compression
(By the way the program compresses data nearly as good as LHA)
The RAW CHUNKY version of the emmaspc.raw digipic would originally take up
81920 bytes of space. However when using